hysop.backend.device.opencl.opencl_copy_kernel_launchers module¶
- class hysop.backend.device.opencl.opencl_copy_kernel_launchers.OpenClCopyBufferLauncher(varname, src, dst, src_device_offset=None, dst_device_offset=None, byte_count=None, **kwds)[source]¶
Bases:
OpenClCopyKernelLauncher
Non-blocking OpenCL copy kernel between host buffers and/or opencl device buffers.
Initialize a (HOST <-> DEVICE) or a (DEVICE <-> DEVICE) copy kernel.
- Parameters:
varname (str) – Name of the variable copied for loggin purposes.
src (cl.MemoryObjectHolder or np.ndarray) – The source buffer.
dst (cl.MemoryObjectHolder or np.ndarray) – The destination buffer.
src_device_offset (int, optional) – Offset in the source buffer, only valid if source buffer is a cl.MemoryObjectHolder.
dst_device_offset (int, optional) – Offset in the source buffer, only valid if source buffer is a cl.MemoryObjectHolder.
byte_count (int) – Byte count to copy if and only if source and destination buffers are cl.MemoryObjectHolders.
Notes
The size of the transfer is controlled by the size of the of the host-side buffer. If the host-side buffer is a numpy.ndarray, you can control the transfer size by transfering into a smaller view of the target array by using indexing,
If neither src nor dst are host buffers, the size is controlled by the parameter byte_count.
Device buffers cannot have views like np.ndarrays, an offset in bytes can be given as src_device_offset or dst_device_offset instead.
- class hysop.backend.device.opencl.opencl_copy_kernel_launchers.OpenClCopyBufferRectLauncher(varname, src, dst, copy_region, copy_src_origin, copy_dst_origin, copy_src_pitches, copy_dst_pitches, iter_region=None, iter_src_origin=None, iter_dst_origin=None, iter_src_pitches=None, iter_dst_pitches=None, **kwds)[source]¶
Bases:
OpenClCopyKernelLauncher
Non-blocking OpenCL copy kernel between host buffers and/or opencl device rectangle subregions of buffers (OpenCL 1.1 and newer).
Supports n-dimensional strided arrays with dimension greater than 3 via iterating over 3D subregions.
Initialize a (HOST <-> DEVICE) or a (DEVICE <-> DEVICE) rectangle subregions copy kernel.
- Parameters:
varname (str) – Name of the variable copied for loggin purposes.
src (cl.MemoryObjectHolder or np.ndarray) – The source buffer.
dst (cl.MemoryObjectHolder or np.ndarray) – The destination buffer.
copy_region (tuple of ints) – The 3D region to copy in terms of bytes for the first dimension and of elements for the two last dimensions.
copy_src_origin (tuple of ints) – The 3D offset in number of elements of the region associated with src buffer. The final src offset in bytes is computed from src_origin and src_pitch.
copy_dst_origin (tuple of ints) – The 3D offset in number of elements of the region associated with dst buffer. The final dst offset in bytes is computed from dst_origin and dst_pitch.
copy_src_pitches (tuple of ints) – The 2D pitches used to compute src offsets in bytes for the second and the third dimension.
copy_dst_pitches (tuple of ints) – The 2D pitches used to compute dst offsets in bytes for the second and the third dimension.
iter_region (tuple of ints) – The n-dimensional region to iterate if the copied region dimension is greater than 3.
iter_src_origin (tuple of ints) – The n-dimensional src array origin if the copied region dimension is greater than 3.
iter_dst_origin (tuple of ints) – The n-dimensional dst array origin if the copied region dimension is greater than 3.
iter_src_pitches (tuple of ints) – The n-dimensional src array pitches if the copied region dimension is greater than 3.
iter_dst_pitches (tuple of ints) – The n-dimensional dst array pitches if the copied region dimension is greater than 3.
kwds (dict) – Base class arguments
- class hysop.backend.device.opencl.opencl_copy_kernel_launchers.OpenClCopyDevice2DeviceLauncher(varname, src, dst, src_device_offset=None, dst_device_offset=None, byte_count=None)[source]¶
Bases:
OpenClCopyBufferLauncher
Reduced interface for device to device copy kernels.
Initialize a (HOST <-> DEVICE) or a (DEVICE <-> DEVICE) copy kernel.
- Parameters:
varname (str) – Name of the variable copied for loggin purposes.
src (cl.MemoryObjectHolder or np.ndarray) – The source buffer.
dst (cl.MemoryObjectHolder or np.ndarray) – The destination buffer.
src_device_offset (int, optional) – Offset in the source buffer, only valid if source buffer is a cl.MemoryObjectHolder.
dst_device_offset (int, optional) – Offset in the source buffer, only valid if source buffer is a cl.MemoryObjectHolder.
byte_count (int) – Byte count to copy if and only if source and destination buffers are cl.MemoryObjectHolders.
Notes
The size of the transfer is controlled by the size of the of the host-side buffer. If the host-side buffer is a numpy.ndarray, you can control the transfer size by transfering into a smaller view of the target array by using indexing,
If neither src nor dst are host buffers, the size is controlled by the parameter byte_count.
Device buffers cannot have views like np.ndarrays, an offset in bytes can be given as src_device_offset or dst_device_offset instead.
- class hysop.backend.device.opencl.opencl_copy_kernel_launchers.OpenClCopyDevice2HostLauncher(varname, src, dst, src_device_offset=None)[source]¶
Bases:
OpenClCopyBufferLauncher
Reduced interface for device to host copy kernels.
Initialize a (HOST <-> DEVICE) or a (DEVICE <-> DEVICE) copy kernel.
- Parameters:
varname (str) – Name of the variable copied for loggin purposes.
src (cl.MemoryObjectHolder or np.ndarray) – The source buffer.
dst (cl.MemoryObjectHolder or np.ndarray) – The destination buffer.
src_device_offset (int, optional) – Offset in the source buffer, only valid if source buffer is a cl.MemoryObjectHolder.
dst_device_offset (int, optional) – Offset in the source buffer, only valid if source buffer is a cl.MemoryObjectHolder.
byte_count (int) – Byte count to copy if and only if source and destination buffers are cl.MemoryObjectHolders.
Notes
The size of the transfer is controlled by the size of the of the host-side buffer. If the host-side buffer is a numpy.ndarray, you can control the transfer size by transfering into a smaller view of the target array by using indexing,
If neither src nor dst are host buffers, the size is controlled by the parameter byte_count.
Device buffers cannot have views like np.ndarrays, an offset in bytes can be given as src_device_offset or dst_device_offset instead.
- class hysop.backend.device.opencl.opencl_copy_kernel_launchers.OpenClCopyHost2DeviceLauncher(varname, src, dst, dst_device_offset=None)[source]¶
Bases:
OpenClCopyBufferLauncher
Reduced interface for host to device copy kernels.
Initialize a (HOST <-> DEVICE) or a (DEVICE <-> DEVICE) copy kernel.
- Parameters:
varname (str) – Name of the variable copied for loggin purposes.
src (cl.MemoryObjectHolder or np.ndarray) – The source buffer.
dst (cl.MemoryObjectHolder or np.ndarray) – The destination buffer.
src_device_offset (int, optional) – Offset in the source buffer, only valid if source buffer is a cl.MemoryObjectHolder.
dst_device_offset (int, optional) – Offset in the source buffer, only valid if source buffer is a cl.MemoryObjectHolder.
byte_count (int) – Byte count to copy if and only if source and destination buffers are cl.MemoryObjectHolders.
Notes
The size of the transfer is controlled by the size of the of the host-side buffer. If the host-side buffer is a numpy.ndarray, you can control the transfer size by transfering into a smaller view of the target array by using indexing,
If neither src nor dst are host buffers, the size is controlled by the parameter byte_count.
Device buffers cannot have views like np.ndarrays, an offset in bytes can be given as src_device_offset or dst_device_offset instead.
- class hysop.backend.device.opencl.opencl_copy_kernel_launchers.OpenClCopyKernelLauncher(name, dst, src, enqueue_copy_kwds, apply_msg, **kwds)[source]¶
Bases:
OpenClKernelLauncher
Interface to non-blocking OpenCL copy kernels.
Initialize an OpenClCopyKernelLauncher.
- Parameters:
enqueue_copy_kwds (dict) – Arguments to to passed to pyopencl.enqueue_copy.
- property enqueue_copy_kwds¶
Return a copy of the keywords arguments that will be passed to pyopencl.enqueue_copy.
- class hysop.backend.device.opencl.opencl_copy_kernel_launchers.OpenClFillKernelLauncher(varname, src, dst, copy_region, copy_src_origin, copy_dst_origin, copy_src_pitches, copy_dst_pitches, iter_region=None, iter_src_origin=None, iter_dst_origin=None, iter_src_pitches=None, iter_dst_pitches=None, **kwds)[source]¶
Bases:
OpenClCopyBufferRectLauncher
Cache buffers to perform a fill operation by using an OpenClCopyBufferRectLauncher.
Initialize a (HOST <-> DEVICE) or a (DEVICE <-> DEVICE) rectangle subregions copy kernel.
- Parameters:
varname (str) – Name of the variable copied for loggin purposes.
src (cl.MemoryObjectHolder or np.ndarray) – The source buffer.
dst (cl.MemoryObjectHolder or np.ndarray) – The destination buffer.
copy_region (tuple of ints) – The 3D region to copy in terms of bytes for the first dimension and of elements for the two last dimensions.
copy_src_origin (tuple of ints) – The 3D offset in number of elements of the region associated with src buffer. The final src offset in bytes is computed from src_origin and src_pitch.
copy_dst_origin (tuple of ints) – The 3D offset in number of elements of the region associated with dst buffer. The final dst offset in bytes is computed from dst_origin and dst_pitch.
copy_src_pitches (tuple of ints) – The 2D pitches used to compute src offsets in bytes for the second and the third dimension.
copy_dst_pitches (tuple of ints) – The 2D pitches used to compute dst offsets in bytes for the second and the third dimension.
iter_region (tuple of ints) – The n-dimensional region to iterate if the copied region dimension is greater than 3.
iter_src_origin (tuple of ints) – The n-dimensional src array origin if the copied region dimension is greater than 3.
iter_dst_origin (tuple of ints) – The n-dimensional dst array origin if the copied region dimension is greater than 3.
iter_src_pitches (tuple of ints) – The n-dimensional src array pitches if the copied region dimension is greater than 3.
iter_dst_pitches (tuple of ints) – The n-dimensional dst array pitches if the copied region dimension is greater than 3.
kwds (dict) – Base class arguments